package com.lk.web.filter;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.lk.entity.Employee;
import com.lk.util.Const;


public abstract class ValidateFilter extends AbstractFilter{
	public void doFilter(ServletRequest req,ServletResponse res,
			FilterChain chain)throws IOException,ServletException{
		HttpServletRequest request = (HttpServletRequest)req;
		HttpServletResponse response = (HttpServletResponse)res;
		
		String uri = request.getRequestURI();
		uri = uri.substring(uri.lastIndexOf("/") + 1);
		System.out.println("uri: " + uri);
		if("".equals(uri) || "index.jspx".equals(uri) || "idnex.jsp".equals(uri) || "login.jspx".equals(uri)){
			chain.doFilter(request,response);
		} else {
			HttpSession session = request.getSession();
			Employee em = (Employee)request.getAttribute(Const.USER_IN_SESSION);
		}
	}
}
